import request from "@/utils/request";

export function getJournals(paramters) {
  return request({
    url: "api/v1/journals",
    method: "get",
    params: paramters,
    authServer: false,
  });
}

export function getJournal(id) {
  return request({
    url: "api/v1/journals/" + id,
    method: "get",
    authServer: false,
  });
}

export function addJournal(data) {
  return request({
    url: "api/v1/journals",
    method: "post",
    data: data,
    authServer: false,
  });
}

export function updateJournal(data) {
  return request({
    url: "api/v1/journals",
    method: "put",
    data: data,
    authServer: false,
  });
}

export function deleteJournal(id) {
  return request({
    url: "api/v1/journals/" + id,
    method: "delete",
    authServer: false,
  });
}

export function getJournalWords(paramters) {
  return request({
    url: "api/v1/journals/words",
    method: "get",
    params: paramters,
    authServer: false,
  });
}

export function getJournalWord(id) {
  return request({
    url: "api/v1/journals/words/" + id,
    method: "get",
    authServer: false,
  });
}

export function addJournalWord(data) {
  return request({
    url: "api/v1/journals/words",
    method: "post",
    data: data,
    authServer: false,
  });
}

export function updateJournalWord(data) {
  return request({
    url: "api/v1/journals/words",
    method: "put",
    data: data,
    authServer: false,
  });
}

export function deleteJournalWord(id) {
  return request({
    url: "api/v1/journals/words/" + id,
    method: "delete",
    authServer: false,
  });
}

export function getJournalNextNumber(numberPrefixId, period) {
  return request({
    url: "api/v1/journals/nextnumber",
    method: "get",
    params: { numberPrefixId: numberPrefixId, period: period },
    authServer: false,
  });
}
